<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:replace="top::html"/> <!-- 引入样式 -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>专家修改页面</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<body class="fixed hold-transition skin-blue">

	<div class="wrapper">
	
		<!-- 引入表头 -->
		<div th:replace="tophtml::html"></div>
		<!-- 引入左边 -->
		<div th:replace="left::html"></div>

		<!-- 右侧修改功能 -->
		<div class="content-wrapper">
			<!-- 页眉 -->
			<section class="content-header">
				<h1>修改专家<small style="font-weight: bolder;color: black;">（<font color="red">*</font>&nbsp;表示不能为空，联系方式请至少填写一种！）</small></h1>
				<ol class="breadcrumb">
					<li><a href="/index"><i class="fa fa-dashboard"></i>用户中心</a></li>
					<li><a href="/person/findPersonList">专家管理</a></li>
					<li><a th:href="@{/person/updateView(pid=${person.pid})}">修改专家</a></li>
				</ol>
			</section>
			<section class="content container-fluid">
				<!-- 表单（添加了表单样式） class="form-inline"  th:object="${person}"-->
				<form id="form1" th:action="@{/person/updatePerson}" method="post" enctype="multipart/form-data">
					<!-- 提醒此人已存在 -->
					<font color="red" style="font-weight: bold;"><input type="hidden" th:utext="${info}"/></font>
					<!-- 加入隐藏标签将主键传递给后台 -->
					<input type="hidden" name="pid" th:value="${person.pid}">
					<input type="hidden" name="expertNumber" th:value="${person.expertNumber}">
					
					<input type="hidden" name="origType" th:value="${origType}">
					<input type="hidden" name="conferencePid" th:value="${conferencePid}">
					
					<div class="form-group">
						<label for="name"><font color="red">*</font>姓名</label> 
						<!-- 非空验证 -->
						<!-- <p style="color: red;" th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Error</p> -->
						<p style="color: red;" th:text="${name}"></p>
						<input type="text" name="name" th:value="${person.name}" class="form-control" placeholder="姓名 ..." required>
					</div>
					<div class="form-group">
						<label>专业领域</label> 
						<input type="text" name="professionaField" th:value="${person.professionaField}" class="form-control" placeholder="专业领域 ...">
					</div>
					<!-- 提醒联系方式至少填写一种 -->
					<font color="red" style="font-weight: bold;"><input type="hidden" th:utext="${alert}"/></font>
					<div class="form-group">
						<label><font color="red">*</font>固定电话</label> 
						<input type="text" name="fixedPhone" class="form-control contact" placeholder="固定电话 ..."
							   th:value="${not #strings.isEmpty(person.fixedPhone)} and ${#strings.length(person.fixedPhone)} >= 7 ? ${#strings.substring(person.fixedPhone, 0, 2)} + '****' + ${#strings.substring(person.fixedPhone, 6, #strings.length(person.fixedPhone))} : ${person.fixedPhone}">
					</div>
					<div class="form-group">
						<label><font color="red">*</font>手机</label> 
						<input type="text" name="tell" class="form-control contact" placeholder="手机 ..."
							   th:value="${not #strings.isEmpty(person.tell)} and ${#strings.length(person.tell)} >= 11 ? ${#strings.substring(person.tell, 0, 3)} + '****' + ${#strings.substring(person.tell, 7, #strings.length(person.tell))} : ${person.tell}">
					</div>
					<div class="form-group">
						<label><font color="red">*</font>邮箱</label> 
						<input type="text" name="email" class="form-control contact" placeholder="邮箱 ..."
							   th:value="${not #strings.isEmpty(person.email)} and ${#strings.length(person.email)} >= 5 ? '****' + ${#strings.substring(person.email, 4, #strings.length(person.email))} : ${person.email}">
					</div>
					<div class="form-group">
						<label><font color="red">*</font>微信</label> 
						<input type="text" name="wechat" class="form-control contact" placeholder="微信 ..."
							   th:value="${not #strings.isEmpty(person.wechat)} and ${#strings.length(person.wechat)} >= 4 ? '***' + ${#strings.substring(person.wechat, 3, #strings.length(person.wechat))} : ${person.wechat}">
					</div>
					<div class="form-group">
						<label><font color="red">*</font>其他联系方式</label> 
						<input type="text" name="otherContact" class="form-control contact" placeholder="其他联系方式 ..."
							   th:value="${not #strings.isEmpty(person.otherContact)} and ${#strings.length(person.otherContact)} >= 4 ? '***' + ${#strings.substring(person.otherContact, 3, #strings.length(person.otherContact))} : ${person.otherContact}">
					</div>
					<div class="form-group">
						<label><font color="red">*</font>专家来源</label> 
						<!-- 非空验证 -->
						<!-- <p style="color: red;" th:if="${#fields.hasErrors('source')}" th:errors="*{source}">Error</p> -->
						<p style="color: red;" th:text="${source}"></p>
						<select name="source" th:field="${person.source}" class="form-control">
							<option th:each="psd : ${projecSourcetDictiontryList}" th:value="${psd.pid}" th:text="${psd.worth}"></option>
						</select>
					</div>
					<div class="form-group">
						<label><font color="red">*</font>专家类型</label> 
						<!-- 非空验证 -->
						<!-- <p style="color: red;" th:if="${#fields.hasErrors('type')}" th:errors="*{type}">Error</p> -->
						<p style="color: red;" th:text="${type}"></p>
						<select name="type" th:field="${person.type}" class="form-control">
							<option th:each="psd : ${personTypeList}" th:value="${psd.pid}" th:text="${psd.worth}"></option>
						</select>
					</div>
					<div class="form-group">
						<label><font color="red">*</font>离退休状态</label> 
						<select name="retireStatus" class="form-control">
							<option th:each="dic : ${personRetireDictiontryList}" th:value="${dic.pid}" th:text="${dic.worth}" th:selected="${dic.pid == person.retireStatus}"></option>
						</select>
					</div>
					<div class="form-group">
						<label for="researchField"><font color="red">*</font>所属领域</label><br/> 
						<!-- 非空验证 -->
						<!-- <p style="color: red;" th:if="${#fields.hasErrors('researchField')}" th:errors="*{researchField}">Error</p> -->
						<p style="color: red;" th:text="${researchField}"></p>
						<div class="checkbox" th:each="collect,iterStat : ${researchFieldDictiontryList}"> 
							<label>
								<input required type="checkbox" name="researchField" th:value="${collect.names}"  th:text="${collect.worth}" th:checked="${#arrays.contains(researchFieldArr,collect.names)}">
							</label>
						</div>
					</div>
					<div class="form-group">
                        <label for="domesticOrForeign"><font color="red">*</font>所在地区</label>
                       <!--  后台非空验证 -->
                        <!-- <p style="color: red;" th:if="${#fields.hasErrors('area')}" th:errors="*{area}">Error</p> -->
                        <p style="color: red;" th:text="${domesticOrForeign}"></p>
                        <p style="color: red;" th:text="${area}"></p>
                        <div class="radio">
                            <label>
                                <input required type="radio" name="domesticOrForeign" id="optionsRadios1" value="0" th:checked="${person.domesticOrForeign == 0}"> 国内
                            </label>
                        </div>
                        <div class="radio">
                            <label>
                                <input required type="radio" name="domesticOrForeign" id="optionsRadios2" value="1" th:checked="${person.domesticOrForeign == 1}"> 国外
                            </label>
                        </div>
                    </div>
                    <div class="form-group form-country">
                        <label><font color="red">*</font>国家</label>
                        <p style="color: red;" th:text="${area}"></p>
                        <select class="form-control form-area">
                            <option value="-1">--选择国家--</option>
                            <option th:each="list:${countryDictiontryList}" th:value="${list.pid}" th:text="${list.worth}" th:selected="${list.pid eq countryId}"></option>
                        </select>
                    </div>
                    <!-- 选择国内必须选地区 -->
                    <div class="form-group form-area">
                        <label><font color="red">*</font>省</label>
                        <p style="color: red;" th:text="${area}"></p>
                        <select class="form-control form-area" id="provinceId">
                            <option value="-1">--选择省--</option>
                            <option th:each="list:${provinceDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq province}"></option>
                        </select>
                    </div>
                    <div class="form-group form-area">
                        <label><font color="red">*</font>市</label>
                        <select class="form-control form-area" id="cityId">
                            <option value="-1">--选择市--</option>
                            <option th:each="list:${cityDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq cityId}"></option>
                        </select>
                    </div>
                    <div class="form-group form-area">
                        <label><font color="red">*</font>区</label>
                        <select class="form-control form-area" id="areaId">
                            <option value="-1">--选择区--</option>
                            <option th:each="list:${areaDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq areaId}"></option>
                        </select>
                    </div>
					<div class="form-group">
						<label>性别</label> 
						<div class="radio">
							<label>
								<input type="radio" name="sex" value="0" th:field="*{person.sex}">男
							</label>
							<label>
								<input type="radio" name="sex" value="1" th:field="*{person.sex}">女
							</label>
						</div>
					</div>
					<div class="form-group">
						<label>出生日期</label>
						<div class="input-group date">
							<div class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" name="birth" th:value="${person.birth}" class="form-control pull-right" id="datepicker">
						</div>
					</div>
					<div class="form-group">
						<label>籍贯</label> 
						<input type="text" name="birthPlace" th:value="${person.birthPlace}" class="form-control" placeholder="省 市 区 ...">
					</div>
					<div class="form-group">
						<label for="exampleInputFile">附件</label> 
						<!-- 将附件annex改为annex1,是为了避免file类型和string类型发生冲突 -->
						<input type="file" name="annex1">
					</div>
					<div class="form-group">
						<label>最高学历</label> 
						<input type="text" name="maxEducation" th:value="${person.maxEducation}" class="form-control" placeholder="最高学历 ...">
					</div>
					<div class="form-group">
						<label>毕业院校及所学专业</label> 
						<input type="text" name="schoolAndMajor" th:value="${person.schoolAndMajor}" class="form-control" placeholder="院校 专业 ...">
					</div>
					<div class="form-group">
						<label>单位</label> 
						<input type="text" name="unit" th:value="${person.unit}" class="form-control" placeholder="单位 ...">
					</div>
					<div class="form-group">
						<label>职称</label> 
						<input type="text" name="title" th:value="${person.title}" class="form-control" placeholder="职称 ...">
					</div>
					<div class="form-group">
						<label>教育背景</label>
						<input type="text" th:value="${person.education}" class="form-control" name="education" placeholder="教育背景 ..."/>
					</div>
					<div class="form-group">
						<label>工作经历</label>
						<input type="text" th:value="${person.workExp}" class="form-control" name="workExp" placeholder="工作经历 ...">
					</div>
					<div class="form-group">
						<label>荣誉奖励</label>
						<input type="text" th:value="${person.honorAward}" class="form-control" name="honorAward" placeholder="荣誉奖励 ...">
					</div>
					<div class="form-group">
						<label>科技成果</label>
						<input type="text" th:value="${person.technica}" class="form-control" name="technica" placeholder="科技成果 ...">
					</div>
					<div class="form-group">
						<label>引用信息来源链接</label>
						<input type="text" class="form-control" th:value="${person.website}" name="website" placeholder="引用信息来源链接 ...">
					</div>
					<div class="form-group">
						<label>人才级别</label><br/> 
						<div class="checkbox" th:each="collect,iterStat : ${talentLevelListByDic}"> 
							<label>
								<input type="checkbox" name="talentLevel" th:value="${collect.names}"  th:text="${collect.worth}" th:checked="${#arrays.contains(talentLevelFieldArr,collect.names)}">
							</label>
						</div>
					</div>
					<div class="form-group">
						<label>个人简介</label>
						<textarea rows="2" cols="1" class="form-control" th:text="${person.personInfo}" name="personInfo" placeholder="字数在2000以内 ..."></textarea>
					</div>
					<div class="form-group">
						<label>备注1</label> 
						<input type="text" name="remark1" th:value="${person.remark1}" class="form-control" placeholder="备注1 ...">
					</div>
					<div class="form-group">
						<label>备注2</label> 
						<input type="text" name="remark2" th:value="${person.remark2}" class="form-control" placeholder="备注2 ...">
					</div>
					<div class="box-footer">
						<a href="/person/findPersonList" class="btn btn-primary">返回主页面</a>
						<button type="submit" class="btn btn-primary">提交</button>
						<button type="button" class="btn btn-primary" onclick="window.history.go(-1)">返回上一级</button>
					</div>
				</form>
			</section>
			<!-- 置顶按钮 -->
			<a href="#0" class="cd-top">Top</a>
		</div><!-- 右侧修改功能结束 -->
		
		<!-- 引入页脚 -->
		<div th:replace="footer::html"></div>
		<div class="control-sidebar-bg"></div> 
	</div>

	<!-- 引入js -->
	<div th:replace="bottom::html" ></div>
</body>
	<script type="text/javascript">
		/* $(function(){
			//隐藏固定电话后四位
			var fixedPhone = $('#fixedPhone').val();
			if(fixedPhone !== undefined && fixedPhone !== null)
			var mfixedPhone = fixedPhone.substr(0, fixedPhone.length-4) + '****';   
			$('#fixedPhone').val(mfixedPhone)
			
			//隐藏手机后四位
			var tell = $('#tell').val();
			if(tell !== undefined && tell !== null)
			var mtell = tell.substr(0, tell.length-4) + '****';   
			$('#tell').val(mtell)
			
			//隐藏邮箱前四位
			var email = $('#email').val(); 
			if(email !== undefined && email !== null && email.length >= 5)
			var memail = '****' + email.substr(4, email.length);   
			$('#email').val(memail)
			
			//隐藏微信后四位
			var wechat = $('#wechat').val();  
			if(wechat !== undefined && wechat !== null)
			var mwechat = wechat.substr(0, wechat.length-4) + '****';   
			$('#wechat').val(mwechat)
			
			//隐藏其他联系方式后四位
			var otherContact = $('#otherContact').val();  
			if(otherContact !== undefined && otherContact !== null)
			var motherContact = otherContact.substr(0, otherContact.length-4) + '****';   
			$('#otherContact').val(motherContact)
		}); */ 
	</script>
</html>